﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="uom.aspx.cs" Inherits="Main_UOM_uom"
    EnableEventValidation="false" %>

<%--<%@ Register TagPrefix="obout" Namespace="Obout.ComboBox" Assembly="obout_ComboBox" %>
<%@ Register TagPrefix="obout" Namespace="Obout.Interface" Assembly="obout_Interface" %>--%>
<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<%@ Register Src="~/User Controls/CommonControls.ascx" TagName="CommonControls" TagPrefix="MyControls" %>
<%@ Register Src="~/User Controls/Pager.ascx" TagPrefix="custom" TagName="Pager" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <link href="../../Styles/accounts.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" language="javascript">
        function isNumberKey(control_id, evt) {
            var charCode = (evt.which) ? evt.which : event.keyCode
            if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode < 45 || charCode > 47))
                return false;

            if (charCode == 46) {
                var dotcount = document.getElementById(control_id).value.split('.').length - 1;
                if (dotcount >= 1) {
                    return false;
                }
            }
            return true;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server">
    </asp:ScriptManager>
    <div class="divmain">
        <asp:Panel ID="pnlmaindata" runat="server" Visible="false">
            <acc:heading ID="Heading1" runat="server" HeadingText="Unit of Measure" />
            <div style="margin-left: 10%; margin-right: 10%; width: 80%">
                <asp:UpdateProgress ID="upprog2" DynamicLayout="false" 
                    runat="server">
                    <ProgressTemplate>
                        <div align="center">
                            <img src="../../Images/ajax-loader.gif" /></div>
                    </ProgressTemplate>
                </asp:UpdateProgress>
            </div>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <Triggers>
                    <%--<asp:PostBackTrigger ControlID="controls" />--%>
                </Triggers>
                <ContentTemplate>
                    <div align="center">
                        <asp:Label ID="lblMsg" runat="server" Font-Bold="true"></asp:Label>
                    </div>
                    <asp:UpdateProgress ID="upprog" AssociatedUpdatePanelID="UpdatePanel1" DynamicLayout="false"
                        runat="server">
                        <ProgressTemplate>
                            <div align="center">
                                <img src="../../Images/ajax-loader.gif" /></div>
                        </ProgressTemplate>
                    </asp:UpdateProgress>
                    <table class="tablecontent" style="width: 40%; margin-left: 30%; margin-right: 30%;
                        border: 1px solid #818181;">
                        <tr>
                            <td class="headtd" colspan="2">
                                UOM Details
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Unit Name <span class="required">*</span>
                            </td>
                            <td>
                                <asp:TextBox ID="txtuname" runat="server" ToolTip="Enter Unit Name" CssClass="input"
                                    MaxLength="30"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RFV1" runat="server" ValidationGroup="unit" ControlToValidate="txtuname"
                                    ErrorMessage="*"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Symbol/Short name<span class="required">*</span>
                            </td>
                            <td>
                                <asp:TextBox ID="txtsym" runat="server" CssClass="input" ToolTip="Enter Symbol/Short name"
                                    MaxLength="30"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RFV2" runat="server" ValidationGroup="unit" ControlToValidate="txtsym"
                                    ErrorMessage="*"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Primary Unit
                            </td>
                            <td>
                                <asp:DropDownList ID="drpprimary" runat="server">
                                </asp:DropDownList>
                                <%-- <obout:ComboBox runat="server" ID="drpprimary" Width="250" Height="200"/>  --%>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Conversion Factor
                            </td>
                            <td>
                                <asp:TextBox ID="txtconv" runat="server" ToolTip="Enter Conversion Factor" CssClass="inputnumber"
                                    onKeyPress="return isNumberKey(this.id,event);"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Decimal Places
                            </td>
                            <td>
                                <asp:TextBox ID="txtdecimal" runat="server" CssClass="inputnumber" ToolTip="Decimal Places"
                                    onKeyPress="return isNumberKey(this.id,event);"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                <asp:Button ID="add_button" runat="server" Text="ADD" CssClass="button" ValidationGroup="unit"
                                    OnClick="add_button_Click" />
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </asp:UpdatePanel>
        </asp:Panel>
    </div>
    <div id="divprint" runat="server" visible="false" align="center">
        <acc:heading ID="Heading2" runat="server" HeadingText="View Unit of Measure" />
        <div style="padding-top: 15px; padding-bottom: 5px; margin-left: 30%;">
            <div style="float: left;">
                <custom:Pager ID="custPager" runat="server" OnPageChanged="custPager_PageChanged" />
            </div>
            <div style="float: left;">
                <asp:ImageButton ID="imgpdf" runat="server" ImageUrl="~/Images/PDF.png" OnClick="imgpdf_Click" />&nbsp;
                <asp:ImageButton ID="imgword" runat="server" ImageUrl="~/Images/word_icon.png" OnClick="imgword_Click" />&nbsp;
                <asp:ImageButton ID="imgxl" runat="server" ImageUrl="~/Images/Excel.png" OnClick="imgxl_Click" />
            </div>
        </div>
        <asp:GridView ID="griduom" runat="server" CssClass="gridview" AutoGenerateColumns="False"
            AllowPaging="True" Width="70%" OnRowEditing="griduom_RowEditing" DataKeyNames="uomid"
            OnRowCancelingEdit="griduom_RowCancelingEdit" OnRowUpdating="griduom_RowUpdating"
            OnPageIndexChanging="griduom_PageIndexChanging">
            <Columns>
                <asp:TemplateField HeaderText="Sr.N.">
                    <ItemTemplate>
                        <%#Container.DataItemIndex+1 %>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Unit Name">
                    <ItemTemplate>
                        <asp:Label ID="lblUnitname" runat="server" Text='<%#Bind("uomname")%>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtunitname" runat="server" Text='<%#Bind("uomname")%>' Width="100px"></asp:TextBox>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Symbol">
                    <ItemTemplate>
                        <asp:Label ID="lblunitsymbol" runat="server" Text='<%#Bind("uomsymbol")%>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtunitsym" runat="server" Text='<%#Bind("uomsymbol")%>' Width="100px"></asp:TextBox>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                            Text="Edit"></asp:LinkButton>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                            Text="Update"></asp:LinkButton>
                        &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                            Text="Cancel"></asp:LinkButton>
                    </EditItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    </form>
</body>
</html>
